import { ArticleService } from '@/service/ArticleServiceI'
import { ArticleDao } from '@/dao/ArticleDao'
import { Service, Inject } from 'typedi';
import { res } from '@/utils/jsonResult';
import { Article, categories ,Articlelabel,tag} from '@/m_res/Article'
import { Any } from 'typeorm';
import { Article as Articlein } from '@/entity/Article';
import { Categories } from '@/entity/Categories';

@Service()
export class ArticleServiceImpl implements ArticleService {

    @Inject()
    articleDao!: ArticleDao
    //标签全部
    async GetArticlelabel():Promise<res<Array<tag|null>>>{
        return await this.articleDao.GetArticlelabelDao()
    }

    //标签 详情
    async GetArticlelabeldetails(id:number):Promise<res<Articlein[]>>{
        return await this.articleDao.GetArticlelabeldetailsDao(id)
    }
    //分类全部
    async GetCategoriesList():Promise<res<Categories[]>>{
        return await this.articleDao.GetArticgoriesListDao()
    }


    //分类 详情
    async GetArticgoriesListinfo(id:number):Promise<res<Articlein[]>>{
        return await this.articleDao.GetArticgoriesListinfoDao(id)
    }
    
    //搜索
    
    async GetSearch(text:string):Promise<res<Articlein[]>>{
        return await this.articleDao.GetSearchDao(text)
    }
}
